home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / PowerPC / vbcc / machines / amigawos / libsrc / AmigaLib / CreateIO.c < prev    next >
C/C++ Source or Header  |  1998-08-02  |  1KB  |  62 lines

  1. /*
  2. ** amiga.lib for vbcc-PowerOpen/WarpOS
  3. **
  4. ** CreateExtIO(), CreateStdIO(), DeleteExtIO(), DeleteStdIO()
  5. **
  6. ** V0.3 30-May-98 phx
  7. **      FreeVecVec() in DeleteExtIO() should have been "FreeVecPPC()".
  8. ** V0.2 19-Apr-98 phx
  9. **      replaced <clib/powerpc/powerpc_protos.h> by <clib/powerpc_protos.h>
  10. **      AllocVecPPC() returns APTR, so a cast is needed
  11. ** V0.1 15-Mar-98 phx
  12. **      created
  13. */
  14.  
  15. #include <exec/io.h>
  16. #include <exec/memory.h>
  17. #include <clib/alib_protos.h>
  18. #include <proto/exec.h>
  19. #include <clib/powerpc_protos.h>
  20.  
  21.  
  22. struct IORequest *CreateExtIO(struct MsgPort *port,long iosize)
  23. {
  24.   struct IORequest *ioreq=NULL;
  25.  
  26.   if (port && (ioreq = (struct IORequest *)
  27.                AllocVecPPC(iosize,MEMF_CLEAR|MEMF_PUBLIC,0)))
  28.   {
  29.     ioreq->io_Message.mn_Node.ln_Type=NT_MESSAGE;
  30.     ioreq->io_Message.mn_ReplyPort=port;
  31.     ioreq->io_Message.mn_Length=iosize;
  32.   }
  33.   return ioreq;
  34. }
  35.  
  36. struct IOStdReq *CreateStdIO(struct MsgPort *port)
  37. {
  38.   return (struct IOStdReq *)CreateExtIO(port,sizeof(struct IOStdReq));
  39. }
  40.  
  41. void DeleteExtIO(struct IORequest *ioreq)
  42. {
  43.   int i;
  44.  
  45.   i=-1;
  46.   ioreq->io_Message.mn_Node.ln_Type=i;
  47.   ioreq->io_Device=(struct Device *)i;
  48.   ioreq->io_Unit=(struct Unit *)i;
  49.   FreeVecPPC((APTR)ioreq);
  50. }
  51.  
  52. void DeleteStdIO(struct IOStdReq *io)
  53. {
  54.   int i;struct IORequest *ioreq=(struct IORequest *)io;
  55.  
  56.   i=-1;
  57.   ioreq->io_Message.mn_Node.ln_Type=i;
  58.   ioreq->io_Device=(struct Device *)i;
  59.   ioreq->io_Unit=(struct Unit *)i;
  60.   FreeVecPPC((APTR)ioreq);
  61. }
  62.